<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>03_JS数据类型</title>
</head>
<body>
  <script>
    var a=1;
    var b=3.14;
    console.log(a,typeof a,b,typeof b);
    var c="hello";
    var d="world";
    console.log(c,typeof c,d,typeof d);
    var e=true;
    var f=false;
    console.log(e,typeof e,f,typeof f);
    var g;//声明了变量，但未赋值，默认值为undefined未定义型
    console.log(g,typeof g);

    let obj={};
    console.log(obj,typeof obj);
    obj.name="张三";
    obj.age=18;
    console.log(obj);
    console.log(obj.name,obj.age);

    let obj2={
      name:"张三",
      age:18
    };
    console.log(obj2);
    console.log(obj2.name,obj2.age);
    obj2.like="吃火锅";
    console.log(obj2);

    let arr=[1,65,84,"sda"];
    console.log(arr,typeof arr);

    console.log(Number(true),typeof Number(true));
    console.log(Number(false));
    console.log(Number('123'));
    console.log(Number(23.5));
    console.log(Number("hhh"));//得不到数字类型的结果就会得到NaN

    console.log(Boolean(false))
    console.log(Boolean(0))
    console.log(Boolean(null))
    console.log(Boolean(undefined))
    console.log(Boolean(NaN))
    console.log(Boolean(""))
    console.log(Boolean(" "))

  </script>
</body>
</html>